package com.openatc.agent.service.impl;

import com.openatc.extend.common.aop.model.WebOperationRecord;
import com.openatc.agent.service.HisParamServiceImpl;
import com.openatc.agent.utils.ApplicationContextProvider;
import com.openatc.extend.common.aop.log.Collector;

import java.util.logging.Logger;

/**
 * @author ：panleilei
 * @description 平台操作记录采集器
 * @modified By：
 * @version:
 * @date ：Created in 2023/3/23 15:56
 */
public class WebOperationCollector implements Collector<WebOperationRecord> {
    private static final Logger logger = Logger.getLogger(WebOperationCollector.class.getSimpleName());
    private HisParamServiceImpl hisParamService = ApplicationContextProvider.getBean(HisParamServiceImpl.class);

    @Override
    public void collect(WebOperationRecord data) {
        int count = hisParamService.saveRecord(data);
        if (count == 0) {
            logger.warning("save webOperationRecord failed!");
        }
    }
}